- Data
- -------------------------
- Different
to basic
-
-
- Data behaves differently to BBC Basic. Expressions
are
- not allowed (eg DATA 10*a) and each Procedure/Function
- has its own local data pointer. Data can only
be read by the
- Procedure/Function that the Data is defined in.
If you need
- global Data similar to BBC Basic here is how
to emulate it:
-
- DefFnReadGlobalData%(Reset%)
- Rem Called
to read from 'global' Data.
- Rem If
Reset% is TRUE a Restore is performed
- Rem to
move the data read pointer to the beginning.
- Rem If
Restore is performed the value returned is random
- Rem otherwise
function returns the next data value.
- Local Value%
- If Reset%
Then
- Restore DataStart
- Else
- Read Value%
- Endif
- =Value%
-
- Instead of the normal:
-
- Read MyValue%
-
- you would then do:
-
- MyValue%=FnReadGlobalData%(False)
-
- and instead of:
-
- Restore 0
(or something like that)
-
- you would do:
-
- MyValue%=FnReadGlobalData%(True)
-